﻿@model Backend.JYD.Model.Cust.CustMarketingInfo
@using Backend.JYD.Common;
@using Backend.JYD.Model.Cust;
@{
    ViewBag.Title = "营销任务修改";
    Layout = "~/Views/Shared/_LayoutWin.cshtml";
    
}
@using (Ajax.BeginForm("edit", new { id = Model.MarketingId }, new AjaxOptions() { OnSuccess = "aftersave" }))
{
    @Html.ValidationSummary(true)
    <div class="ui_pop_body" style="width: 600px; height: 350px;">
        <div>
            <ul class="edit-ul">
                <li class="li01">
                    <span class="s01">@Html.LabelFor(model => model.CustNo)：</span>
                    <span class="s02">@Html.DisplayFor(model => model.CustNo)</span>
                </li>
                <li class="li01">
                    <span class="s01">@Html.LabelFor(model => model.CustName)：</span>
                    <span class="s02"><label>@Html.DisplayFor(model => model.CustName)</label></span>
                </li>
                <li class="li01">
                    <span class="s01">@Html.LabelFor(model => model.ScheduleTime)：</span>
                    <span class="s02">
                        <input  type="text" name="ScheduleTime" id="ScheduleTime" value="@(Model == null || !Model.ScheduleTime.HasValue ? string.Empty : DateTimeHelper.GetDateShortFormat(Model.ScheduleTime.Value))"  onfocus="WdatePicker()" readonly="readonly" class="text-box single-line" data-val="true" data-val-required="计划接触时间 字段是必需的。" />
                        <img class="hand" onclick="WdatePicker({el:'ScheduleTime'})" src="/skin/datepicker/skin/datePicker.gif" width="16" height="22" align="absmiddle" />
                    </span>
                    <i class="i01">@Html.ValidationMessageFor(model => model.ScheduleTime)</i>
                </li>                
                <li class="li01">
                    <span class="s01">@Html.LabelFor(model => model.ValidDays)：</span>
                    <span class="s02">@Html.EditorFor(model => model.ValidDays)</span>
                    <i class="i01">@Html.ValidationMessageFor(model => model.ValidDays)</i>
                </li>
                <li class="li01">
                    <span class="s01">@Html.LabelFor(model => model.Memo)：</span>
                    <span class="s02">@Html.TextAreaFor(model => model.Memo, new { @row = "5" })</span>
                    <i class="i01">@Html.ValidationMessageFor(model => model.Memo)</i>
                </li>
            
                <li class="li01">
                    <span class="s01"></span>
                    <span class="s02">
                        <input type="submit" value="提交" onclick="return check()"/>
                        <input type="button" value="取消" onclick="closeWin()"/>
                        @Html.HiddenFor(model => model.MarketingId)
                        @Html.HiddenFor(model => model.TaskDetailId)
                        @Html.HiddenFor(model => model.TaskId)
                        @Html.HiddenFor(model => model.Status)
                    </span>
                </li>
            </ul>
        </div>
     </div>
    <script src="@Url.Content("~/skin/js/jquery.unobtrusive-ajax.min.js")" type="text/javascript"></script>
    <script src="/skin/datepicker/WdatePicker.js" type="text/javascript"></script>
    <script type="text/javascript">
        function aftersave(data) {
            if (data.code) {
                closeWinAndReload();
            }
            else {
                alert(data.msg);
            }
        }

        function check() {
            var sdate = $('#ScheduleTime').val();
            if (!sdate) {
                alert("请选择计划接触时间。");
                return false;
            }
            else {
                if (!DateCompare("@DateTimeHelper.GetDateLongFormat(DateTime.Today)", sdate)) {
                    alert("计划接触时间，不能小于当前时间。");
                    return false;
                }
            }
            if (!$('#ValidDays').val()) {
                alert("请填写有效天数");
                return false;
            }

            return true;
        }

    </script>
}


